<?php 
function buginfo($name,$value=array(),$filepath="",$login_time=""){
    $buginfo="";
    $data_buginfo=array();
    if($login_time==""){
        $login_time=date("Y-m-d H:i:s");
    }
    $data_buginfo['update_time']=$login_time;
    $data_buginfo['name']="";
    if(is_string($name)) {
        if(!preg_match("/".addsla($filepath)."/",$buginfo)) {
            $buginfo .= "时间：" . $login_time . "\n";
            $buginfo .= "文件:<span class=\"red\">" . $filepath . "</span>\n";
        }
        $buginfo.="参数名:".$name."\n";
        $buginfo.="<textarea class='source'>".print_r($value,1)."</textarea>\r\n";
        $data_buginfo['name'] = $name;
        $data_buginfo['value'] = $buginfo;
        $data_buginfo['path'] = $filepath;
    }else{
        foreach ($name as $key=>$v){
            if(!preg_match("/".addsla($filepath)."/",$buginfo)) {
                $buginfo .= "时间：" . $login_time . "\n";
                $buginfo .= "文件:<span class=\"red\">" . $filepath . "</span>\n";
            }
            $buginfo.="参数名:".$key."\n";
            $buginfo.="<textarea class='source'>".print_r($v,1)."</textarea>\r\n";
            $data_buginfo['name'].=$key.",";
        }
        $data_buginfo['value'] = $buginfo;
        $data_buginfo['path'] =  $filepath;
    }
    insertupdate("yangzs_u.buginfo",$data_buginfo,"select id from yangzs_u.buginfo where update_time='{$data_buginfo['update_time']}' and name='{$data_buginfo['name']}'");
}

function gettime(){
    date_default_timezone_set('Asia/Shanghai'); // 设置时区，根据实际情况修改
    $microtime = microtime(true);
    $milliseconds = round($microtime * 1000);
    $date_with_ms = date("Y-m-d H:i:s", floor($microtime)). '.'. sprintf('%03d', $milliseconds % 1000);
    $timezone = date_default_timezone_get();
    if ($timezone!= 'Asia/Shanghai') {
        $date_with_ms = date("Y-m-d H:i:s", floor($microtime) + 8 * 3600). '.'. sprintf('%03d', $milliseconds % 1000);
    }
    return $date_with_ms;
}

function my_autoloader($class_name) {
    $file = dirname($_SERVER["SCRIPT_FILENAME"])."/".$class_name. ".php";
    if (file_exists($file)) {
        include($file);
    }
}
spl_autoload_register("my_autoloader");
